@extends('app')
@include('UEditor::head')
@section('content')
<ul class="nav nav-tabs">
    <li ><a href="{{ url('/admin/content/news')}}">新闻列表</a></li>
    <li class="active"><a href="{{ url('/admin/content/news/create') }}">添加</a></li>
</ul>
<form id="newsForm" method="post" action="/admin/content/news">
    <div class="description2">
        <div class="form-group">
            <div class="col-sm-2 control-label">新闻标题:</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" name="title" id="title" placeholder="新闻标题" value="">
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">作者:</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" name="author" id="author" placeholder="作者" value="">
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">新闻详情:</div>
            <div class="col-sm-10">
                <script id="detail" name="detail"  style="width:100%;margin:0 auto;height:200px;" type="text/plain">
                </script>
            </div>
            <div class="clearfix"></div>
        </div>
        {!! csrf_field() !!}
        <input type="hidden" name="id" value="0">
        <div class="form-inline mt20">
            <div class="form-group col-xs-offset-1">
                <input type="submit"  class="btn  btn-info" value="submit" />
            </div>
            <div class="form-group col-xs-offset-1">
                <input type="reset" class="btn" value="reset" />
            </div>
        </div>
    </div>
</form>

<script type="text/javascript">
<!--
$('input').iCheck({
	checkboxClass: 'icheckbox_flat-blue',
    radioClass: 'iradio_flat-blue',
    increaseArea: '-10' // optional
});
//-->

var ue = UE.getEditor('detail');
ue.ready(function() {
    var introduction = '@if(!empty($news)) {!! str_replace(array("\r\n", "\r", "\n"),"",str_replace("'",'"',$news->detail))!!} @endif';
    ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
    ue.setContent(introduction);
});

</script>
@endsection
